package com.aita.diamond;

import com.gd.domain.party.Operator
import com.gd.domain.party.Organization
import com.gd.magic.Column
import com.gd.domain.party.Photo

class Diamond extends com.gd.magic.RootEntity  {
	static int idLength = 8
	
	PurchaseBill purchaseBill   //采购单
	Order order                 //销售单/订单
	Organization org			//库存地点
	FactoryBill factoryBill			//裸钻加工单
	Operator oper				//联机操作员
	
	@Column (dict="diamondType",notNull=true)
	int diamondType				//钻石类型
	@Column (dict="diamondStatus",notNull=true)
	int diamondStatus			//钻石状态(1:在库,2:售出,3:定制中,4:计划采购)
	@Column (dict="PurchaseBillType")
	int type					//采购类型，1:自主采购、   （2:订单采购、3:借货采购）
	@Column (dict="certificateType")
	int certificateType				//证书类型
	String  certificateNo 			//证书编号
	Photo photo      //图片

	//基本属性
	long amount			//计算价格(元)
	long discount		//采购时填写：采购折扣
	long costPrice		//采购时填写：采购价
	long weight			//克拉/100
	@Column (dict="colorType")
	int colorType		//颜色
	@Column (dict="neatness")
	int neatness      //净度
	
	@Column (dict="cut")
	int  cut  //切工
	@Column (dict="shape")
	int shape //琢型
	@Column (dict="polishing")
	int  polishing  //抛光
	@Column (dict="symmetry")
	int  symmetry  //对称 
	@Column (dict="heartAndArrow")
	int  heartAndArrow  //八心八箭

	
	public void preUpdate(boolean isNew) {
		if(isNew) {
			diamondType = 1
		}
		
		super.preUpdate(isNew)
	}
}